package cn.xiao.rpc;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;

import java.io.IOException;

public class RPCServer implements Bizable{

    public String sayHi(String name){
        return "HI" + name;
    }

    public static void main(String[] args) throws IOException {

        RPC.Server server = new RPC.Builder(new Configuration())
                // 暴露的接口
                .setProtocol(Bizable.class)
                // 实例
                .setInstance(new RPCServer())
                // 绑定的ip地址，这里绑定的是win的ip地址，这里有个坑，需要联网
                .setBindAddress(ServerConfig.IP_ADDRESS)
                // 设置端口
                .setPort(ServerConfig.PORT).build();
        server.start();
    }

}
